package com.yidu.king.utils;

/**
 * <p>@Description: 消息类</p>
 * <p>@Author yidu-liandyao</p>
 * <p>@Date: 2021-01-06</p>
 * <p>@Time: 9:27</p>
 */
public class BaseMessage {
    private int state ;//状态
    private String msg ; //消息
    private Object data ;//数据

    /**
     * 操作成功的方法
     * @param data
     * @return
     */
    public static BaseMessage succes(Object data){
        BaseMessage bm = new BaseMessage();
        bm.setData(data);
        bm.setMsg("操作成功!");
        bm.setState(1);
        return bm ;
    }

    /**
     * 操作成功的方法
     * @return
     */
    public static BaseMessage succes(){
        BaseMessage bm = new BaseMessage();
        bm.setMsg("操作成功!");
        bm.setState(1);
        return bm ;
    }

    /**
     * 操作失败的方法
     * @return
     */
    public static BaseMessage fail(){
        BaseMessage bm = new BaseMessage();
        bm.setMsg("操作失败!");
        bm.setState(0);
        return bm ;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
